<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <script src="/static/js/jquery-1.11.3.js"></script>
  <link href="/static/css/bootstrap.min.css" rel="stylesheet">
  <link href="/static/css/animate.min.css" rel="stylesheet">
  <link href="/static/css/main.css" rel="stylesheet">
  <link href="/static/css/page.css" rel="stylesheet">
  <link href="/static/css/responsive.css" rel="stylesheet">
  <link href="/static/iconfont/iconfont.css" rel="stylesheet" />

  <script src="/static/js/jquery.js"></script>
  <script src="/static/js/bootstrap.min.js"></script>
  <script src="/static/js/jquery.SuperSlide.js" type="text/javascript"></script>
  <script src="/static/js/NSW_Index.js"></script>
  <style>
    #content {
      overflow: hidden;
      text-align: center
    }

    .fl {
      width: 33%
    }
  </style>
</head>
<header id="header">
  <nav class="navbar navbar-inverse" role="banner">
    <div class="container">
      <div class="row">
        <div class="col-md-3 navbar-header">
          <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
            <span class="sr-only">Toggle navigation</span>
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
          </button>
          <a class="navbar-brand" href="index.html"><img src="/static/images/10.jpg" alt="logo"
              class="img-responsive"></a>
        </div>
        <div class="col-md-9">
          <div class="tel">24小时服务热线：<span>0755-29961998</span></div>
          <div class="collapse navbar-collapse navbar-right">
            <ul class="nav navbar-nav">
              <li class="active">
                <a href="http://127.0.0.1:8000/publish/model_view/">订单类型</a>
              </li>
              <li>
                <a href="http://127.0.0.1:8000/order/order_list_view/">我的订单</a>
              </li>
              <li>
                <a href="http://127.0.0.1:8000/evaluation/list_view/">我的评价</a>
              </li>
              <li>
                <a href="http://127.0.0.1:8000/user/user_view/">我的信息</a>
              </li>
              

            </ul>
          </div>
        </div>
      </div>
    </div>
  </nav>
</header>
<div class="banner2">
  <p style="background:url(/static/images/sub_banner_about.jpg) no-repeat center; background-size:cover;"></p>
</div>

<body>
  <section class="container"></section>
  <div class="head">选择类型</div>
  <div id="content"></div>
  <center>
    <script>

      token = window.localStorage.getItem('moh_token');
      username = window.localStorage.getItem('moh_user');
      if (!username) {
        alert("请先登录")
        window.location.href = 'http://127.0.0.1:8000/user/login_view/';
      } else {
        $.ajax({
          type: "get",
          url: "http://127.0.0.1:8000/publish/models",
          beforeSend: function (request) {
            request.setRequestHeader("Authorization", token);
          },
          success: function (data) {
            var html = ""
            if (data.code == 200) {
              var models = data.data.models;
              for (var i in models) {
                item = models[i];
                console.log(item.model_code);
                html += '<div class="fl">';
                html += '<img id =' + item.model_code + ' class="clickImage" src="http://127.0.0.1:8000/media/' + item.model_img + '"' + 'alt="" onclick="imgclick(this)" height="400" width="400">';
                html += '<br>';
                html += '<span>' + item.title + '</span>'
                html += '</div>';
              }
            } else {
              alert(data.error);
            }
            $("#content").html(html);
          },
          error: function (e) {
            alert(data);
          }
        })
      }

      $("#save").on("click", function () {
        var username = $("#username").val()
        var realname = $("#realname").val()
        var phone = $("#phone").val()
        var address = $("#address").val()
        local_username = window.localStorage.getItem('moh_user');
        $.ajax({
          type: "post",
          url: "http://127.0.0.1:8000/user/usersave/" + local_username,
          data: JSON.stringify({ "username": username, "phone": phone, "realname": realname, "address": address }),
          headers: { 'Content-Type': "application/json" },
          beforeSend: function (request) {
            request.setRequestHeader("Authorization", token);
          },
          success: function (data) {
            if (data.code == 200) {

              alert('保存成功！');

            } else {
              alert(data.error);
            }
          },
          error: function (e) {
            alert(data);
          }
        })
      });
      function imgclick(obj) {
        var model_code = $(obj).attr("id");
        window.location.href = 'http://127.0.0.1:8000/publish/order_view/' + model_code;
      }
    </script>
  </center>
  <!-- 安全 Start -->
  <section class="service-v1">
    <div class="container">
      <div class="row">
        <div class="col-sm-4 col-md-4 col-lg-4">
          <div class="item">
            <div class="icon">
              <i class="iconfont">&#xe620;</i>
            </div>
            <div class="text">
              <div class="inner">
                <h3>正规公司，值得信赖</h3>
                <p>工商注册备案，安全可靠！</p>
              </div>
            </div>
          </div>
        </div>
        <div class="col-sm-4 col-md-4 col-lg-4">
          <div class="item">
            <div class="icon">
              <i class="iconfont">&#xe633;</i>
            </div>
            <div class="text">
              <div class="inner">
                <h3>安全保障，持证上岗</h3>
                <p>三证齐全（身份证，健康证，育婴师证）疾病排查，身份联网确认</p>
              </div>
            </div>
          </div>
        </div>
        <div class="col-sm-4 col-md-4 col-lg-4">
          <div class="item">
            <div class="icon">
              <i class="iconfont">&#xe614;</i>
            </div>
            <div class="text">
              <div class="inner">
                <h3>异地服务，更贴心</h3>
                <p>专注母婴护理，你在哪，我们的服务就在哪里</p>
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>
  </section>



  <!--footer-->
  <footer id="footer">
    <div class="container">
      <span>
        <a href="http://127.0.0.1:8000/publish/model_view/">订单类型 </a>
        <a href="http://127.0.0.1:8000/order/order_list_view/">我的订单</a>
        <a href="http://127.0.0.1:8000/evaluation/list_view/">我的评价</a>
        <a href="http://127.0.0.1:8000/user/user_view/">我的信息</a>
      </span>
     
      <span>联系地址：深圳宝安西乡街道兴业路西南侧碧海富通城1栋110 &nbsp;&nbsp; 联系方式：0755-29961998<br>
        Copyright © 2005-2023 All rights reserved. 京ICP备10012705号-8 </span>
    </div>
  </footer>
</body>

</html>